package com.vincent.kdp.ui.fragment.repository;


import com.loopj.android.http.RequestParams;
import com.vincent.baseapp.util.SPUtil;
import com.vincent.kdp.PostUrl;
import com.vincent.kdp.http.HttpUtil;
import com.vincent.kdp.http.RequestCallBack;
import com.vincent.kdp.ui.Constants;
import com.vincent.kdp.ui.bean.response.NewCommodityListOutput;
import com.vincent.kdp.util.BaseParam;

public class NewRepository {

    /**
     * 获取商品系列列表
     *
     * @param callBack 回调方法
     */
    public void reqCommodityTypeList(RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_TYPE_LIST, params, NewCommodityListOutput.class, callBack);
    }
    /**
     * 根据商品系列id获取商品列表
     *
     * @param typeId   商品系列id
     * @param callBack 回调方法
     */
    public void reqCommoditiesByTypeId(int typeId, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("seriesId", typeId);
        SPUtil.put(Constants.SPKeys.seriesId, true);
        HttpUtil.loadData(PostUrl.GET_NEW_COMMODITY_LIST, params, NewCommodityListOutput.class, callBack);
    }


}
